//
//  TwoButtonView.m
//  Simple Life
//
//  Created by lanou3g on 15/11/14.
//  Copyright © 2015年 wyt. All rights reserved.
//

#import "TwoButtonView.h"

@interface TwoButtonView ()

@property (nonatomic,strong)UIButton *buttonOne;
@property (nonatomic,strong)UIButton *buttonTwo;
@property (nonatomic,strong)UIButton *saveButton;

@property (nonatomic,strong)UIView *redView;

@end

@implementation TwoButtonView

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.buttonOne = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.buttonOne.frame = CGRectMake(0, 0, self.frame.size.width / 2, self.frame.size.height - 1);
        self.buttonOne.tag = 1000;
        
        [self.buttonOne addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
        
        [self.buttonOne setTitle:@"食之味" forState:(UIControlStateSelected)];
        [self.buttonOne setTitle:@"食之味" forState:(UIControlStateNormal)];
    //颜色
        self.buttonOne.backgroundColor = [UIColor colorWithRed:225/255.0 green:205/255.0 blue:188/255.0 alpha:0.8];
    
        self.buttonOne.selected = YES;
        [self addSubview:self.buttonOne];
        
        
        //第二个
        self.buttonTwo = [UIButton buttonWithType:(UIButtonTypeCustom)];
        
        self.buttonTwo.frame = CGRectMake(self.frame.size.width / 2, 0, self.frame.size.width / 2, self.frame.size.height - 1);
        
        [self.buttonTwo setTitle:@"甜品" forState:(UIControlStateSelected)];
        
        self.saveButton = self.buttonOne;
        
        [self.buttonTwo addTarget:self action:@selector(buttonClicked:) forControlEvents:(UIControlEventTouchUpInside)];
        
        [self.buttonTwo setTitle:@"甜品" forState:(UIControlStateNormal)];
        self.buttonTwo.tag = 1001;
        
        self.buttonTwo.backgroundColor = [UIColor colorWithRed:225/255.0 green:205/255.0 blue:188/255.0 alpha:0.8];
        [self addSubview:self.buttonTwo];
        
        
        
    }
    return self;
}

-(void)buttonClicked:(UIButton *)sender
{
    
    self.saveButton.backgroundColor = [UIColor colorWithRed:225/255.0 green:205/255.0 blue:188/255.0 alpha:0.8];
   // sender.backgroundColor = [UIColor ]
    
    
    
}

-(void)setButtonClicked:(NSInteger)index
{
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
